package com.xdkj.service.impl;

import com.xdkj.mapper.StudentMapper;
import com.xdkj.pojo.Student;
import com.xdkj.service.StuService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * @author ：李浩(Anthony)
 * @description：
 * @date ：Created in 2021/10/21 15:00
 */
@Service
public class StuServiceImpl implements StuService {
    @Autowired
    StudentMapper studentMapper;
    @Override
    public List<Student> queryAll() {
        List<Student> students = studentMapper.queryAll();
        return students;
    }

    @Override
    public Student selectByPrimaryKey(Integer sid) {
        Student student = studentMapper.selectByPrimaryKey(sid);
        return student;
    }

    @Override
    public boolean Del(int sid) {
        int i = studentMapper.deleteByPrimaryKey(sid);
        if (i>0) {
            return true;
        }else {
            return false;
        }
    }

    @Override
    public boolean Add(Student student) {
        int i = studentMapper.insert(student);
        if (i>0) {
            return true;
        }else {
            return false;
        }
    }

    @Override
    public boolean Update(Student student) {
        int i = studentMapper.updateByPrimaryKey(student);
        if (i>0) {
            return true;
        }else {
            return false;
        }
    }


}
